<?php get_header(); ?>
	<?php if ( !is_home() && !is_page() && !is_single() ) { ?><div id="pagetitle"><?php navigation_title(); ?></div><?php } ?>
	<?php if (have_posts()) : ?>
	<?php while (have_posts()) : the_post(); ?>
		<div id="post-<?php the_ID(); ?>" <?php post_class('post'); ?>>
			<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
			<?php if (!is_page()) { ?><div class="meta">
				On <?php the_time('F j, Y'); ?> / 
				By <?php if (get_the_author_url()) { ?><a href="<?php the_author_url(); ?>"><?php the_author(); ?></a><?php } else { the_author(); } ?> / 
				<?php if (!is_attachment()) { ?> In <?php the_category(', '); } ?> / 
				<?php if (!is_single()) { ?><?php comments_popup_link('No Comments', '1 Comment', '% Comments'); } else { ?><a href="#respond">Reply</a>
				<?php } edit_post_link('Edit', ' / ', ''); ?>
			</div><?php } ?>
			<div class="content clear">
				<?php if (is_single() || is_page()) { the_content(); } else { $excerpt = explode("[...]",get_the_excerpt()); echo $excerpt[0]; ?> <a class="more-link" href="<?php the_permalink() ?>">More...</a><?php } ?>
				<?php link_pages('<p>Pages: ', '</p>', 'number'); ?>
			</div>
			<?php the_tags('<div class="meta">Tags: ',', ','</div>'); ?>
		</div>
		<?php if (is_single()) { ?>
		<div class="navigation clear">
			<div class="alignleft"><?php previous_post_link('%link','&laquo; %title') ?></div>
			<div class="alignright"><?php next_post_link('%link','%title &raquo;') ?></div>
		</div>		
		<div id="commentsection"><?php comments_template('', true); ?></div>
		<?php } ?>
		<?php endwhile; ?>
		
		<?php if (!is_single()) { ?>
		<div class="navigation clear">
			<div class="alignleft"><?php previous_posts_link('&laquo; Browse Newer Entries') ?></div>
			<div class="alignright"><?php next_posts_link('Browse Older Entries &raquo;') ?></div>
		</div>
		<?php } ?>
	
	<?php else: ?>
		<div class="post">
			<div class="content">
				<p>What you're looking for seems to be missing. Try going back, or using the search bar.</p>
			</div>
		</div>
	<?php endif; ?>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>